<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title></title>
  <style type="text/css">
    .error{
      color:red;
    }
  </style>
  <script src="../../static/assets/js/jquery.min.js"></script>
  <script type="application/javascript">
    function register(){
      var formData = {username:$("#username").val(),password:$("#password").val(),name:$("#name").val()};
      $.ajax({
        url:"/api/v1/driver/user",
        type:"put",
        contentType:"application/json",
        data:JSON.stringify(formData),
        dataType:"jsonp",
        success: function(result){
        }
      });
    }
  </script>
</head>
<body>
  <form:form id="registryForm" method="POST" action="/registry" commandName="userDto">
    <table>
      <tr>
        <td>用户名：</td>
        <td>
          <input type="text" id="username" name="username" value=""/>
          <form:errors path="username" cssClass="error"/>
        </td>
      </tr>
      <tr>
        <td>密码：</td>
        <td><input type="password" id="password" name="password" value=""/></td>
      </tr>
      <tr>
        <td>姓名：</td>
        <td><input type="text" id="name" name="name" value=""/></td>
      </tr>
      <tr>
        <td colspan="2"><input type="submit" value="注册"/></td>
      </tr>
      <tr>
        <td colspan="2"><a href="javascript:void(0);" onclick="register();">ajax 注册</a></td>
      </tr>
    </table>
  </form:form>
</body>
</html>
